﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SydEnergiPrototype.DataRepositoryServiceRef;
using SydEnergiPrototype.Kernel;
using SydEnergiPrototype.Model;

namespace SydEnergiPrototype.Logic
{
    public class ParserFactory : IParserFactory
    {
        private readonly Dictionary<Type, Parser> _parsers;

        public ParserFactory()
        {
            _parsers = new Dictionary<Type, Parser>();
            _parsers.Add(typeof(AddressDto), new AddressParser());
            _parsers.Add(typeof(Address), new AddressParser());
            _parsers.Add(typeof(HistoryEntryDto), new HistoryEntryParser());
            _parsers.Add(typeof(HistoryEntry), new HistoryEntryParser());
            _parsers.Add(typeof(EntryDto), new EntryParser(new BrushParser(), this));
            _parsers.Add(typeof(Entry), new EntryParser(new BrushParser(), this));
            _parsers.Add(typeof(IEntry), new EntryParser(new BrushParser(), this));
            _parsers.Add(typeof(SerializableEntry), new EntryParser(new BrushParser(), this));
            _parsers.Add(typeof(CabinetDto), new CabinetParser(this));
            _parsers.Add(typeof(ICabinet), new CabinetParser(this));
            _parsers.Add(typeof(Cabinet), new CabinetParser(this));
        }

        public Parser Make(Type subjectType)
        {
            return _parsers[subjectType];
        }
    }
}
